/*
 * @Author: your name
 * @Date: 2020-01-05 14:08:17
 * @LastEditTime : 2020-01-05 14:47:29
 * @LastEditors  : Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \p5.home\32-0105\0105\routes\db.js
 */
/* 引入mongoose */
var mongoose = require('mongoose');
/* 链接数据库 shuang为数据库名 */
mongoose.connect('mongodb://localhost:27017/shuang', function (err) {
    if (err) {
        /* 执行失败 */
        console.log('数据库连接失败');
    } else {
        /* 执行成功 */
        console.log('数据库连接成功');
    }
})
/* Schema设置库的表 */
var Schema = mongoose.Schema;
/* 接收 title 辩题 message 简述 _id 数据_id  content 详细内容  createTime 创建时间*/
var shSchema = new Schema({
    title: String,
    message: String,
    content: String,
    image: String,
    createTime: String,
})
/* one 为表名 */
var Model = mongoose.model('one', shSchema);
module.exports = Model;